package com.zrc.superframe_aop

import android.annotation.SuppressLint
import android.app.Application
import android.content.Context

/**
 * @Author: superman
 * @CreateTime: 8/21/21
 * @Describe:
 */
@SuppressLint("StaticFieldLeak")
object SuperAop {

    private lateinit var context: Context

    var debug: Boolean = false//log的开关,在Application中设置，上线关闭，测试打开

    var logFlag: String = "SuperAop"//log日志TAG

    /**
     * 初始化
     */
    fun init(application: Application): SuperAop {
        context = application.applicationContext
        return this
    }

    /**
     * 是否初始化
     */
    fun isInit() = this::context.isInitialized

    /**
     * 是否开启Log日志
     */
    fun setDebug(debug: Boolean): SuperAop {
        this.debug = debug
        return this
    }

    /**
     * 是否开启Log日志
     */
    fun setLog(logFlag: String = "SuperAop"): SuperAop {
        this.logFlag = logFlag
        return this
    }

}